# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PrivateCA.V1.Model.CertificateDescription do
  @moduledoc """
  A CertificateDescription describes an X.509 certificate or CSR that has been issued, as an alternative to using ASN.1 / X.509.

  ## Attributes

  *   `aiaIssuingCertificateUrls` (*type:* `list(String.t)`, *default:* `nil`) - Describes lists of issuer CA certificate URLs that appear in the "Authority Information Access" extension in the certificate.
  *   `authorityKeyId` (*type:* `GoogleApi.PrivateCA.V1.Model.KeyId.t`, *default:* `nil`) - Identifies the subject_key_id of the parent certificate, per https://tools.ietf.org/html/rfc5280#section-4.2.1.1
  *   `certFingerprint` (*type:* `GoogleApi.PrivateCA.V1.Model.CertificateFingerprint.t`, *default:* `nil`) - The hash of the x.509 certificate.
  *   `crlDistributionPoints` (*type:* `list(String.t)`, *default:* `nil`) - Describes a list of locations to obtain CRL information, i.e. the DistributionPoint.fullName described by https://tools.ietf.org/html/rfc5280#section-4.2.1.13
  *   `publicKey` (*type:* `GoogleApi.PrivateCA.V1.Model.PublicKey.t`, *default:* `nil`) - The public key that corresponds to an issued certificate.
  *   `subjectDescription` (*type:* `GoogleApi.PrivateCA.V1.Model.SubjectDescription.t`, *default:* `nil`) - Describes some of the values in a certificate that are related to the subject and lifetime.
  *   `subjectKeyId` (*type:* `GoogleApi.PrivateCA.V1.Model.KeyId.t`, *default:* `nil`) - Provides a means of identifiying certificates that contain a particular public key, per https://tools.ietf.org/html/rfc5280#section-4.2.1.2.
  *   `tbsCertificateDigest` (*type:* `String.t`, *default:* `nil`) - The hash of the pre-signed certificate, which will be signed by the CA. Corresponds to the TBS Certificate in https://tools.ietf.org/html/rfc5280#section-4.1.2. The field will always be populated.
  *   `x509Description` (*type:* `GoogleApi.PrivateCA.V1.Model.X509Parameters.t`, *default:* `nil`) - Describes some of the technical X.509 fields in a certificate.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :aiaIssuingCertificateUrls => list(String.t()) | nil,
          :authorityKeyId => GoogleApi.PrivateCA.V1.Model.KeyId.t() | nil,
          :certFingerprint => GoogleApi.PrivateCA.V1.Model.CertificateFingerprint.t() | nil,
          :crlDistributionPoints => list(String.t()) | nil,
          :publicKey => GoogleApi.PrivateCA.V1.Model.PublicKey.t() | nil,
          :subjectDescription => GoogleApi.PrivateCA.V1.Model.SubjectDescription.t() | nil,
          :subjectKeyId => GoogleApi.PrivateCA.V1.Model.KeyId.t() | nil,
          :tbsCertificateDigest => String.t() | nil,
          :x509Description => GoogleApi.PrivateCA.V1.Model.X509Parameters.t() | nil
        }

  field(:aiaIssuingCertificateUrls, type: :list)
  field(:authorityKeyId, as: GoogleApi.PrivateCA.V1.Model.KeyId)
  field(:certFingerprint, as: GoogleApi.PrivateCA.V1.Model.CertificateFingerprint)
  field(:crlDistributionPoints, type: :list)
  field(:publicKey, as: GoogleApi.PrivateCA.V1.Model.PublicKey)
  field(:subjectDescription, as: GoogleApi.PrivateCA.V1.Model.SubjectDescription)
  field(:subjectKeyId, as: GoogleApi.PrivateCA.V1.Model.KeyId)
  field(:tbsCertificateDigest)
  field(:x509Description, as: GoogleApi.PrivateCA.V1.Model.X509Parameters)
end

defimpl Poison.Decoder, for: GoogleApi.PrivateCA.V1.Model.CertificateDescription do
  def decode(value, options) do
    GoogleApi.PrivateCA.V1.Model.CertificateDescription.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PrivateCA.V1.Model.CertificateDescription do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
